package cn.com.nes.site.service.marketing.impl;

import cn.com.nes.mybatis.agent.activity.entity.ActiveSession;
import cn.com.nes.mybatis.agent.activity.mapper.ActiveSessionMapper;
import cn.com.nes.site.service.marketing.ActiveSessionService;
import cn.com.nes.site.service.marketing.bo.ActiveSessionBO;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class ActiveSessionServiceImpl extends ServiceImpl<ActiveSessionMapper, ActiveSession> implements ActiveSessionService {


    @Override
    public ActiveSession getActivityTemplateInfo(ActiveSessionBO activeSessionBO) throws Exception {
        LambdaQueryWrapper<ActiveSession> wrapper = new LambdaQueryWrapper<ActiveSession>();
        if (StrUtil.isNotEmpty(activeSessionBO.getActivityUuid())) {
            wrapper.eq(ActiveSession::getUuid, activeSessionBO.getActivityUuid());
        }
        if (StrUtil.isNotEmpty(activeSessionBO.getActivityName())) {
            wrapper.eq(ActiveSession::getActivename, activeSessionBO.getActivityName());
        }
        return this.getOne(wrapper);
    }

}
